package thread;

import java.util.Scanner;

/**
 * 使程序阻塞设定的毫秒数
 */
public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("请输入要倒计的秒数：");
        Scanner scanner = new Scanner(System.in);
        int number = scanner.nextInt();

        for (int i = number; i > 0 ; i--) {
            System.out.println("倒计时：" + i + "s");
            try {
                Thread.sleep(1000);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("倒计时：0s,程序结束了");
    }
}
